<template>
  <div class="global-title-card-container">
    <div class="title-card-header" v-if="titleVisible">
      <div class="title-card-title">{{ title }}</div>
      <div class="title-card-right">
        <slot name="header"></slot>
      </div>
    </div>
    <div class="title-card-content" :style="{height: titleVisible?'calc(100% - 55px)':'100%'}">
      <slot name="content"></slot>
      <slot></slot>
    </div>
  </div>
</template>

<script>
export default {
  name: "TitleCard",
  props: {
    titleVisible: {
      type: Boolean,
      default: true,
    },
    title: {
      type: String,
      default: () => "",
    },
  },
};
</script>

<style scoped lang="scss">
.global-title-card-container {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;

  .title-card-header {
    padding: 16px 12px;
    height: 48px;
    box-sizing: border-box;
    border-bottom: 1px solid #eee;
    display: flex;
    align-items: center;
    justify-content: space-between;
    .title-card-title{
      font-size: 15px;
    }

    .title-card-right {
      color: #606266;
      font-size: 14px;
    }
  }

  .title-card-content {
    width: 100%;
    position: relative;
    overflow: hidden;
    box-sizing: border-box;
    padding: 12px;
  }
}
</style>
